package com.simplegui.swing;

import java.io.File;
import java.net.URL;

import javax.imageio.ImageIO;

import com.simplegui.api.ImageFile;
import com.simplegui.api.ImageFileLoader;

public class ImageFileLoaderSwingImpl implements ImageFileLoader{

	@Override
	public ImageFile load(String fileName) {
		try {
			URL url = ClassLoader.getSystemResource(fileName);
        	File file = new File(url.toURI());
			return new ImageFileSwingImpl(ImageIO.read(file));
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
